<?php

class controller_module_breadcrumbs extends __registry_controller {

    public $_ = array();

    public function __construct() {
        parent::add_object(array(
            'model_module_breadcrumbs',
            'handle_route'
        ));
        $this->_layout = NULL;
    }

    public function index() {
        $this->view = new system_view();
        
        /*get file html*/
        $html = $this->view->view_display_module('breadcrumbs');        
        /*get block html*/
        $arrHtml = $this->view->view_get_block_html($html);
        /*get all seokey in url*/
        $seo_key = $this->rt_get_all_val_seo();
        $strOkHtml = '';
        $name = '';
        if (isset($seo_key)) {
            $name = $this->mdbr_get_name_seokey($seo_key[0]);
            $strOkHtml .= $this->view->view_assign($arrHtml['list_breakcrum'], array(
                'url' => URL_BASE . $seo_key[0],
                'name' => $name['CatName']
                    ));
        }
		   
		if(isset($seo_key[1]))
		{
			$name = $this->mdbr_get_name_seokey($seo_key[1]);
			$strOkHtml .= $this->view->view_assign($arrHtml['list_breakcrum'], array(
				'url' => URL_BASE . 'admin/' . $seo_key[1],
				'name' => '&nbsp;»&nbsp;'.$name['CatName']
			));
			
			if(isset($seo_key[2])){
				$arr_bearum = $this->mdbr_get_seokey(trim($seo_key[2]));
				$tt = (count($arr_bearum)-1);
				for ($j=$tt; $j>=0; $j--) {
					if($arr_bearum[$j]['CatName'])
					$strOkHtml .= $this->view->view_assign($arrHtml['list_breakcrum'], array(
						'url' => URL_BASE . 'admin/' .$seo_key[1] .'/'. $arr_bearum[$j]['SeoKey'],
						'name' => '&nbsp;»&nbsp;'.$arr_bearum[$j]['CatName']
							));
				}
			}
		
		}
		
				
        /*set html and data to bock html in the file*/
        $strHtmlContent = $this->view->view_assign_block($html, array('breakcrum' => $strOkHtml));
        return $strHtmlContent;
    }

}